<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$pagetitle}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
  <!--select2 js start-->
  <link rel="stylesheet" href="/static/select2/select2.css" media="all">
  <!--select2 js end-->
  <style>
    .set-select2 .select2-container .select2-choice{ height: 36px; line-height: 36px;}
    .set-select2 .select2-container .select2-choice .select2-arrow b{ background: url(/static/select2/select2.png) no-repeat 0 4px;}
    .select2-results .select2-highlighted{ background: #009688;}
     .layui-table th,.layui-table td{
       text-align: center;
     }
  </style>
</head>
<body>

<div class="layui-fluid">
  <div class="layui-card">

    <div class="layui-form-header">
      <div class="header-left">
        {block name="left"}
        {/block}
      </div>

      <div class="header-right">
        <form action="{:url()}" method="get">
          {block name="right"}
          {/block}
        </form>
      </div>

    </div>


    <div class="layui-card-body">
      {block name="content"}
      {/block}
    </div>

  </div>
</div>
<a href="" id="download_a" hidden></a>

<script src="/static/admin/layui/layui.js"></script>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/globals.js"></script>
<!--select2 js start-->
<script src="/static/select2/select2.js"></script>
<!--select2 js end-->
<script>

  $('.select2').select2();
  let laydate;
  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'laydate'], function(){
    var $ = layui.$
            ,admin = layui.admin
            ,element = layui.element;
            laydate = layui.laydate;
    //示例代码

    //开始日期
    var insStart = laydate.render({
      elem: '#test-laydate-start'
      ,done: function(value, date){
        //更新结束日期的最小日期
        insEnd.config.min = lay.extend({}, date, {
          month: date.month - 1
        });
        //自动弹出结束日期的选择器
        insEnd.config.elem[0].focus();
      }
    });

    //结束日期
    var insEnd = laydate.render({
      elem: '#test-laydate-end'
      // ,min: 0
    });

    laydate.render({
      elem: '#time-month'
      ,type: 'month'
      ,max: 1
    });

  });
  //删除
  function this_delete(){
    layer.confirm("您确定要删除吗？",function(){
      $('.layui-form').attr('action','{:url("delete")}');
      $('.layui-form').submit();
    },function(){layer.closeAll();return false;});
  }
  //取消审核
  function cancel_checked(){
    layer.confirm("您确定要取消审核吗？",function(){
      $('.layui-form').attr('action','{:url("cancelChecked")}');
      $('.layui-form').submit();
    },function(){layer.closeAll();return false;});
  }
  //栏目跳转
  function goLink(obj){
    var catid=$(obj).val();
    var url="{:url('Info/index')}?catid="+catid+"&keywords=";
    window.location.href=url;
  }
  //复制信息
  function copy_info(){
    var chk_value =[];//定义一个数组
    $('input[name="ids[]"]:checked').each(function(){
      chk_value.push($(this).val());
    });
    iframe("{:url('copy',['catid'=>$cat['catid']])}&ids="+chk_value);
  }
  //移动信息
  function move_info(){
    var chk_value =[];//定义一个数组
    $('input[name="ids[]"]:checked').each(function(){
      chk_value.push($(this).val());
    });
    iframe("{:url('move',['catid'=>$cat['catid']])}&ids="+chk_value);
  }
  //导出
  function export_info(){
    var chk_value =[];//定义一个数组
    $('input[name="ids[]"]:checked').each(function(){
      chk_value.push($(this).val());
    });
    iframe("{:url('export',['catid'=>$cat['catid']])}&ids="+chk_value,"800px");
  }
</script>


<script>
  function bandJigou(){
    var chk_value =[];//定义一个数组
    $('input[name="ids[]"]:checked').each(function(){
      chk_value.push($(this).val());
    });
    if(chk_value.length == 0){
      layer.msg('没有数据被选中')
    }else{
      layer.open({type: 2,title: '绑定机构',area: ['100%', '100%'],fix: false, maxmin: true,content: "{:url('addJigou',['supplier_id'=>$_GET['supplier_id']])}&ids="+chk_value});

    }
    // iframe();
  }

  function wuliao_delete(){
    var url= '';
    var msg= '';
    var chk_value =[];//定义一个数组
    $('input[name="ids[]"]:checked').each(function(){
      chk_value.push($(this).val());
    });
    if(chk_value.length == 0){
      layer.msg('没有数据被选中')
      return false;
    }
    url= "{:url('delete',['supplier_id'=>$_GET['supplier_id']])}&ids="+chk_value;
    if(!msg){
      msg="您确定要删除吗？";
    }
    layer.confirm(msg,function(){
      ajax_del(url);
    });
    return false;
  }
</script>

{block name="js"}
{/block}


  <script>
    function exportTable(){
    // 使用outerHTML属性获取整个table元素的HTML代码（包括<table>标签），然后包装成一个完整的HTML文档，设置charset为urf-8以防止中文乱码
    var html = "<html><head><meta charset='utf-8' /></head><body>" + document.getElementsByTagName("table")[0].outerHTML + "</body></html>";
    // 实例化一个Blob对象，其构造函数的第一个参数是包含文件内容的数组，第二个参数是包含文件类型属性的对象
    var blob = new Blob([html], { type: "application/vnd.ms-excel" });
    var a = document.getElementById("download_a");
    // 利用URL.createObjectURL()方法为a元素生成blob URL
    a.href = URL.createObjectURL(blob);
    // 设置文件名
    a.download = "{$exportName}.xls";
    a.click()
  }
</script>

</body>
</html>
